package com.fierce.cloud.core.web.responseDto;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 统一Api响应结果封装
 * @author Fierce
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Response<T> implements Serializable {

    private static final long serialVersionUID = 5843754594225568199L;


    public Response(int code, String msg, Boolean result) {
        this.code = code;
        this.message = msg;
        this.result = result;
    }

    /**
     * 状态码
     * @mock 200
     * @since 1.0
     */
    private int code;

    /**
     * 消息
     * @mock 请求成功
     * @since 1.0
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String message;

    /**
     * 结果
     *
     * @since 1.0
     */
    private Boolean result;

    /**
     * 数据
     * @mock 返回的数据
     * @since 1.0
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private T data;
}
